#include<iostream>
#include<string>
#include<unordered_set>
using namespace std;

class Solution {
public:
	int numJewelsInStones(string jewels, string stones) {
		unordered_set<char> set;
		for (char ch : jewels) {
			set.insert(ch);
		}
		int result = 0;
		for (char ch : stones) {
			if (set.count(ch))
				result++;
		}
		return result;
	}
};

void main() {
	string jewels = "aA", stones = "aAAbbbb";
	Solution s;
	int total=s.numJewelsInStones(jewels, stones);
	cout << total << endl;
}